package com.ling.sbbyyds.mapper.video;

import com.ling.sbbyyds.entity.video.Video;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

@Repository
public interface VideoMapper extends Mapper<Video> {

    /**
     * 获取视频喜欢数量（点赞）
     *
     * @param videoId 视频id
     * @return
     */
    @Select("SELECT like_num AS likeNum, id FROM sbb_video_info WHERE id = #{videoId} AND is_del = 0 AND state = 0 ")
    Video getVideoLikeNum(Long videoId);

    /**
     * 获取视频是否存在
     *
     * @param videoId 视频id
     * @return
     */
    @Select("SELECT count(*) FROM sbb_video_info WHERE id = #{videoId} AND is_del = 0 AND state = 0 ")
    Integer getVideoIsExit(Long videoId);

}
